/********************************************************************
FileName    :   Dal_yw_rkdH.cs
CreateTime  :   2015-09-18 12:09
BaseClass   :   Dal_yw_rkdH
FileType    :   .cs
Author      :  minjie
Description :   Dal_yw_rkdHDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
	/// <summary>
	/// Dal_yw_rkdH的摘要说明。
	/// </summary>
	public partial class Dal_yw_rkdH 
  	{ 
     		      
  		public bool Exists(int DjLsh) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) from yw_rkdH"); 
  			strSql.Append(" where "); 
           SqlParameter[] parameters = { new SqlParameter("@DjLsh", SqlDbType.Int,4)};  
  			return DbHelperSQL.Exists(strSql.ToString(),parameters); 
  		} 
  		 
  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(yw_rkdH_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into yw_rkdH(");			 
  	strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,rkrq,djzt,rkdh,rkbmh,rkbm,ckbh,ckmc,gysbh,gysmc,rklx,bz,slhj,jehj,xj,qk,zr,yfk,wfk,cgdh,zdr,zdsj,shr,shsj,gyszk,ddh,lsjehj,khmc) values ("); 
  	strSql.Append("	@DjLsh,@DjBtZdh,@DjFtZdh,@DjStZdh,@DjState,@DjCount,@rkrq,@djzt,@rkdh,@rkbmh,@rkbm,@ckbh,@ckmc,@gysbh,@gysmc,@rklx,@bz,@slhj,@jehj,@xj,@qk,@zr,@yfk,@wfk,@cgdh,@zdr,@zdsj,@shr,@shsj,@gyszk,@ddh,@lsjehj,@khmc	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjFtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjStZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@DjCount", SqlDbType.Int,4) ,              
              new SqlParameter("@rkrq", SqlDbType.DateTime) ,              
              new SqlParameter("@djzt", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rkdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rkbmh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rkbm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ckbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ckmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gysbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gysmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rklx", SqlDbType.VarChar,50) ,              
              new SqlParameter("@bz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@slhj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jehj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@qk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zr", SqlDbType.Decimal,9) ,              
              new SqlParameter("@yfk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@wfk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@cgdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@zdr", SqlDbType.VarChar,50) ,              
              new SqlParameter("@zdsj", SqlDbType.DateTime) ,              
              new SqlParameter("@shr", SqlDbType.VarChar,50) ,              
              new SqlParameter("@shsj", SqlDbType.DateTime) ,              
              new SqlParameter("@gyszk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ddh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@lsjehj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@khmc", SqlDbType.VarChar,50)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBtZdh;  
              
              parameters[2].Value = model.DjFtZdh;  
              
              parameters[3].Value = model.DjStZdh;  
              
           if (model.DjState != null)  
              parameters[4].Value = model.DjState;  
           else  
              parameters[4].Value = DBNull.Value;  
              
              parameters[5].Value = model.DjCount;  
              
           if (model.rkrq != null)  
              parameters[6].Value = model.rkrq;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.djzt != null)  
              parameters[7].Value = model.djzt;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.rkdh != null)  
              parameters[8].Value = model.rkdh;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.rkbmh != null)  
              parameters[9].Value = model.rkbmh;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.rkbm != null)  
              parameters[10].Value = model.rkbm;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.ckbh != null)  
              parameters[11].Value = model.ckbh;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.ckmc != null)  
              parameters[12].Value = model.ckmc;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.gysbh != null)  
              parameters[13].Value = model.gysbh;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.gysmc != null)  
              parameters[14].Value = model.gysmc;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.rklx != null)  
              parameters[15].Value = model.rklx;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.bz != null)  
              parameters[16].Value = model.bz;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.slhj != null)  
              parameters[17].Value = model.slhj;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.jehj != null)  
              parameters[18].Value = model.jehj;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.xj != null)  
              parameters[19].Value = model.xj;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.qk != null)  
              parameters[20].Value = model.qk;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.zr != null)  
              parameters[21].Value = model.zr;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.yfk != null)  
              parameters[22].Value = model.yfk;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.wfk != null)  
              parameters[23].Value = model.wfk;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.cgdh != null)  
              parameters[24].Value = model.cgdh;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.zdr != null)  
              parameters[25].Value = model.zdr;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.zdsj != null)  
              parameters[26].Value = model.zdsj;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.shr != null)  
              parameters[27].Value = model.shr;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.shsj != null)  
              parameters[28].Value = model.shsj;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.gyszk != null)  
              parameters[29].Value = model.gyszk;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.ddh != null)  
              parameters[30].Value = model.ddh;  
           else  
              parameters[30].Value = DBNull.Value;  
              
           if (model.lsjehj != null)  
              parameters[31].Value = model.lsjehj;  
           else  
              parameters[31].Value = DBNull.Value;  
              
           if (model.khmc != null)  
              parameters[32].Value = model.khmc;  
           else  
              parameters[32].Value = DBNull.Value;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(yw_rkdH_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBtZdh==null) 
  				{ 
  					model.DjBtZdh=0; 
  				} 
  				if(model.DjFtZdh==null) 
  				{ 
  					model.DjFtZdh=0; 
  				} 
  				if(model.DjStZdh==null) 
  				{ 
  					model.DjStZdh=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.DjCount==null) 
  				{ 
  					model.DjCount=0; 
  				} 
  				if(model.djzt==null) 
  				{ 
  					model.djzt="";  
  				} 
  				if(model.rkdh==null) 
  				{ 
  					model.rkdh="";  
  				} 
  				if(model.rkbmh==null) 
  				{ 
  					model.rkbmh="";  
  				} 
  				if(model.rkbm==null) 
  				{ 
  					model.rkbm="";  
  				} 
  				if(model.ckbh==null) 
  				{ 
  					model.ckbh="";  
  				} 
  				if(model.ckmc==null) 
  				{ 
  					model.ckmc="";  
  				} 
  				if(model.gysbh==null) 
  				{ 
  					model.gysbh="";  
  				} 
  				if(model.gysmc==null) 
  				{ 
  					model.gysmc="";  
  				} 
  				if(model.rklx==null) 
  				{ 
  					model.rklx="";  
  				} 
  				if(model.bz==null) 
  				{ 
  					model.bz="";  
  				} 
  				if(model.slhj==null) 
  				{ 
  					model.slhj=0; 
  				} 
  				if(model.jehj==null) 
  				{ 
  					model.jehj=0; 
  				} 
  				if(model.xj==null) 
  				{ 
  					model.xj=0; 
  				} 
  				if(model.qk==null) 
  				{ 
  					model.qk=0; 
  				} 
  				if(model.zr==null) 
  				{ 
  					model.zr=0; 
  				} 
  				if(model.yfk==null) 
  				{ 
  					model.yfk=0; 
  				} 
  				if(model.wfk==null) 
  				{ 
  					model.wfk=0; 
  				} 
  				if(model.cgdh==null) 
  				{ 
  					model.cgdh="";  
  				} 
  				if(model.zdr==null) 
  				{ 
  					model.zdr="";  
  				} 
  				if(model.shr==null) 
  				{ 
  					model.shr="";  
  				} 
  				if(model.gyszk==null) 
  				{ 
  					model.gyszk=0; 
  				} 
  				if(model.ddh==null) 
  				{ 
  					model.ddh="";  
  				} 
  				if(model.lsjehj==null) 
  				{ 
  					model.lsjehj=0; 
  				} 
  				if(model.khmc==null) 
  				{ 
  					model.khmc="";  
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into yw_rkdH(");			 
  	strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,rkrq,djzt,rkdh,rkbmh,rkbm,ckbh,ckmc,gysbh,gysmc,rklx,bz,slhj,jehj,xj,qk,zr,yfk,wfk,cgdh,zdr,zdsj,shr,shsj,gyszk,ddh,lsjehj,khmc) values ("); 
  	strSql.Append("	"+ model.DjLsh+","+ model.DjBtZdh+","+ model.DjFtZdh+","+ model.DjStZdh+",'"+ model.DjState+"',"+ model.DjCount+",'"+ model.rkrq+"','"+ model.djzt+"','"+ model.rkdh+"','"+ model.rkbmh+"','"+ model.rkbm+"','"+ model.ckbh+"','"+ model.ckmc+"','"+ model.gysbh+"','"+ model.gysmc+"','"+ model.rklx+"','"+ model.bz+"',"+ model.slhj+","+ model.jehj+","+ model.xj+","+ model.qk+","+ model.zr+","+ model.yfk+","+ model.wfk+",'"+ model.cgdh+"','"+ model.zdr+"','"+ model.zdsj+"','"+ model.shr+"','"+ model.shsj+"',"+ model.gyszk+",'"+ model.ddh+"',"+ model.lsjehj+",'" +model.khmc+"'	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(yw_rkdH_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update yw_rkdH set "); 
              strSql.Append(" DjLsh = @DjLsh,"); 
              strSql.Append(" DjBtZdh = @DjBtZdh,"); 
              strSql.Append(" DjFtZdh = @DjFtZdh,"); 
              strSql.Append(" DjStZdh = @DjStZdh,"); 
              strSql.Append(" DjState = @DjState,"); 
              strSql.Append(" DjCount = @DjCount,"); 
              strSql.Append(" rkrq = @rkrq,"); 
              strSql.Append(" djzt = @djzt,"); 
              strSql.Append(" rkdh = @rkdh,"); 
              strSql.Append(" rkbmh = @rkbmh,"); 
              strSql.Append(" rkbm = @rkbm,"); 
              strSql.Append(" ckbh = @ckbh,"); 
              strSql.Append(" ckmc = @ckmc,"); 
              strSql.Append(" gysbh = @gysbh,"); 
              strSql.Append(" gysmc = @gysmc,"); 
              strSql.Append(" rklx = @rklx,"); 
              strSql.Append(" bz = @bz,"); 
              strSql.Append(" slhj = @slhj,"); 
              strSql.Append(" jehj = @jehj,"); 
              strSql.Append(" xj = @xj,"); 
              strSql.Append(" qk = @qk,"); 
              strSql.Append(" zr = @zr,"); 
              strSql.Append(" yfk = @yfk,"); 
              strSql.Append(" wfk = @wfk,"); 
              strSql.Append(" cgdh = @cgdh,"); 
              strSql.Append(" zdr = @zdr,"); 
              strSql.Append(" zdsj = @zdsj,"); 
              strSql.Append(" shr = @shr,"); 
              strSql.Append(" shsj = @shsj,"); 
              strSql.Append(" gyszk = @gyszk,"); 
              strSql.Append(" ddh = @ddh,"); 
              strSql.Append(" lsjehj = @lsjehj,"); 
              strSql.Append(" khmc = @khmc"); 
  			strSql.Append(" where  DjLsh=@DjLsh "); 
  						 
  SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjFtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjStZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@DjCount", SqlDbType.Int,4) ,              
              new SqlParameter("@rkrq", SqlDbType.DateTime) ,              
              new SqlParameter("@djzt", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rkdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rkbmh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rkbm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ckbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ckmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gysbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gysmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@rklx", SqlDbType.VarChar,50) ,              
              new SqlParameter("@bz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@slhj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jehj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@qk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zr", SqlDbType.Decimal,9) ,              
              new SqlParameter("@yfk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@wfk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@cgdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@zdr", SqlDbType.VarChar,50) ,              
              new SqlParameter("@zdsj", SqlDbType.DateTime) ,              
              new SqlParameter("@shr", SqlDbType.VarChar,50) ,              
              new SqlParameter("@shsj", SqlDbType.DateTime) ,              
              new SqlParameter("@gyszk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ddh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@lsjehj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@khmc", SqlDbType.VarChar,50)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBtZdh;  
              
              parameters[2].Value = model.DjFtZdh;  
              
              parameters[3].Value = model.DjStZdh;  
              
           if (model.DjState != null)  
              parameters[4].Value = model.DjState;  
           else  
              parameters[4].Value = DBNull.Value;  
              
              parameters[5].Value = model.DjCount;  
              
           if (model.rkrq != null)  
              parameters[6].Value = model.rkrq;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.djzt != null)  
              parameters[7].Value = model.djzt;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.rkdh != null)  
              parameters[8].Value = model.rkdh;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.rkbmh != null)  
              parameters[9].Value = model.rkbmh;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.rkbm != null)  
              parameters[10].Value = model.rkbm;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.ckbh != null)  
              parameters[11].Value = model.ckbh;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.ckmc != null)  
              parameters[12].Value = model.ckmc;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.gysbh != null)  
              parameters[13].Value = model.gysbh;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.gysmc != null)  
              parameters[14].Value = model.gysmc;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.rklx != null)  
              parameters[15].Value = model.rklx;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.bz != null)  
              parameters[16].Value = model.bz;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.slhj != null)  
              parameters[17].Value = model.slhj;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.jehj != null)  
              parameters[18].Value = model.jehj;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.xj != null)  
              parameters[19].Value = model.xj;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.qk != null)  
              parameters[20].Value = model.qk;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.zr != null)  
              parameters[21].Value = model.zr;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.yfk != null)  
              parameters[22].Value = model.yfk;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.wfk != null)  
              parameters[23].Value = model.wfk;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.cgdh != null)  
              parameters[24].Value = model.cgdh;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.zdr != null)  
              parameters[25].Value = model.zdr;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.zdsj != null)  
              parameters[26].Value = model.zdsj;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.shr != null)  
              parameters[27].Value = model.shr;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.shsj != null)  
              parameters[28].Value = model.shsj;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.gyszk != null)  
              parameters[29].Value = model.gyszk;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.ddh != null)  
              parameters[30].Value = model.ddh;  
           else  
              parameters[30].Value = DBNull.Value;  
              
           if (model.lsjehj != null)  
              parameters[31].Value = model.lsjehj;  
           else  
              parameters[31].Value = DBNull.Value;  
              
           if (model.khmc != null)  
              parameters[32].Value = model.khmc;  
           else  
              parameters[32].Value = DBNull.Value;  
              
              int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(int  DjLsh) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from yw_rkdH "); 
  			strSql.Append(" where  DjLsh=@DjLsh"); 
  			SqlParameter[] parameters = {  new SqlParameter("@DjLsh", SqlDbType.Int,4) };  
    parameters[0].Value = DjLsh;  
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string DjLshlist ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from yw_rkdH "); 
  			strSql.Append(" where ID in ("+DjLshlist + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public yw_rkdH_Entity GetModel(int   DjLsh) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,rkrq,djzt,rkdh,rkbmh,rkbm,ckbh,ckmc,gysbh,gysmc,rklx,bz,slhj,jehj,xj,qk,zr,yfk,wfk,cgdh,zdr,zdsj,shr,shsj,gyszk,ddh,lsjehj,khmc");	
		strSql.Append("  from yw_rkdH"); 
  			strSql.Append(" where  DjLsh=@DjLsh "); 
  			SqlParameter[] parameters = {  new SqlParameter("@DjLsh", SqlDbType.Int,4) };  
    parameters[0].Value = DjLsh;  
  			 
  			yw_rkdH_Entity model=new yw_rkdH_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  			 
  			if(ds!=null&&ds.Tables[0].Rows.Count>0) 
  			{ 
  		DataTable dt=ds.Tables[0];	  
  				if(dt.Rows[0]["DjLsh"]!=null&&dt.Rows[0]["DjLsh"].ToString()!="") 
  				{ 
  					model.DjLsh=int.Parse(dt.Rows[0]["DjLsh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjBtZdh"]!=null&&dt.Rows[0]["DjBtZdh"].ToString()!="") 
  				{ 
  					model.DjBtZdh=int.Parse(dt.Rows[0]["DjBtZdh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjFtZdh"]!=null&&dt.Rows[0]["DjFtZdh"].ToString()!="") 
  				{ 
  					model.DjFtZdh=int.Parse(dt.Rows[0]["DjFtZdh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjStZdh"]!=null&&dt.Rows[0]["DjStZdh"].ToString()!="") 
  				{ 
  					model.DjStZdh=int.Parse(dt.Rows[0]["DjStZdh"].ToString()); 
  				} 
  				model.DjState= dt.Rows[0]["DjState"].ToString(); 
  				if(dt.Rows[0]["DjCount"]!=null&&dt.Rows[0]["DjCount"].ToString()!="") 
  				{ 
  					model.DjCount=int.Parse(dt.Rows[0]["DjCount"].ToString()); 
  				} 
  				if(dt.Rows[0]["rkrq"]!=null&&dt.Rows[0]["rkrq"].ToString()!="") 
  				{ 
  					model.rkrq=DateTime.Parse(dt.Rows[0]["rkrq"].ToString()); 
  				} 
  				model.djzt= dt.Rows[0]["djzt"].ToString(); 
  				model.rkdh= dt.Rows[0]["rkdh"].ToString(); 
  				model.rkbmh= dt.Rows[0]["rkbmh"].ToString(); 
  				model.rkbm= dt.Rows[0]["rkbm"].ToString(); 
  				model.ckbh= dt.Rows[0]["ckbh"].ToString(); 
  				model.ckmc= dt.Rows[0]["ckmc"].ToString(); 
  				model.gysbh= dt.Rows[0]["gysbh"].ToString(); 
  				model.gysmc= dt.Rows[0]["gysmc"].ToString(); 
  				model.rklx= dt.Rows[0]["rklx"].ToString(); 
  				model.bz= dt.Rows[0]["bz"].ToString(); 
  				if(dt.Rows[0]["slhj"]!=null&&dt.Rows[0]["slhj"].ToString()!="") 
  				{ 
  					model.slhj=decimal.Parse(dt.Rows[0]["slhj"].ToString()); 
  				} 
  				if(dt.Rows[0]["jehj"]!=null&&dt.Rows[0]["jehj"].ToString()!="") 
  				{ 
  					model.jehj=decimal.Parse(dt.Rows[0]["jehj"].ToString()); 
  				} 
  				if(dt.Rows[0]["xj"]!=null&&dt.Rows[0]["xj"].ToString()!="") 
  				{ 
  					model.xj=decimal.Parse(dt.Rows[0]["xj"].ToString()); 
  				} 
  				if(dt.Rows[0]["qk"]!=null&&dt.Rows[0]["qk"].ToString()!="") 
  				{ 
  					model.qk=decimal.Parse(dt.Rows[0]["qk"].ToString()); 
  				} 
  				if(dt.Rows[0]["zr"]!=null&&dt.Rows[0]["zr"].ToString()!="") 
  				{ 
  					model.zr=decimal.Parse(dt.Rows[0]["zr"].ToString()); 
  				} 
  				if(dt.Rows[0]["yfk"]!=null&&dt.Rows[0]["yfk"].ToString()!="") 
  				{ 
  					model.yfk=decimal.Parse(dt.Rows[0]["yfk"].ToString()); 
  				} 
  				if(dt.Rows[0]["wfk"]!=null&&dt.Rows[0]["wfk"].ToString()!="") 
  				{ 
  					model.wfk=decimal.Parse(dt.Rows[0]["wfk"].ToString()); 
  				} 
  				model.cgdh= dt.Rows[0]["cgdh"].ToString(); 
  				model.zdr= dt.Rows[0]["zdr"].ToString(); 
  				if(dt.Rows[0]["zdsj"]!=null&&dt.Rows[0]["zdsj"].ToString()!="") 
  				{ 
  					model.zdsj=DateTime.Parse(dt.Rows[0]["zdsj"].ToString()); 
  				} 
  				model.shr= dt.Rows[0]["shr"].ToString(); 
  				if(dt.Rows[0]["shsj"]!=null&&dt.Rows[0]["shsj"].ToString()!="") 
  				{ 
  					model.shsj=DateTime.Parse(dt.Rows[0]["shsj"].ToString()); 
  				} 
  				if(dt.Rows[0]["gyszk"]!=null&&dt.Rows[0]["gyszk"].ToString()!="") 
  				{ 
  					model.gyszk=decimal.Parse(dt.Rows[0]["gyszk"].ToString()); 
  				} 
  				model.ddh= dt.Rows[0]["ddh"].ToString(); 
  				if(dt.Rows[0]["lsjehj"]!=null&&dt.Rows[0]["lsjehj"].ToString()!="") 
  				{ 
  					model.lsjehj=decimal.Parse(dt.Rows[0]["lsjehj"].ToString()); 
  				} 
  				model.khmc= dt.Rows[0]["khmc"].ToString(); 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by T." + orderby); 
 } 
else  
 { 
     strSql.Append("order by T.DjLsh desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from yw_rkdH T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM yw_rkdH "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM yw_rkdH "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM yw_rkdH "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
